﻿<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<script type="text/javascript" src="lib/PIE_IE678.js"></script>
<![endif]-->
<link rel="stylesheet" type="text/css" href="../static/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css" href="../static/h-ui.admin/css/H-ui.admin.css" />
<link rel="stylesheet" type="text/css" href="../lib/Hui-iconfont/1.0.7/iconfont.css" />
<link rel="stylesheet" type="text/css" href="../lib/icheck/icheck.css" />
<link rel="stylesheet" type="text/css" href="../static/h-ui.admin/skin/default/skin.css" id="skin" />
<link rel="stylesheet" type="text/css" href="../static/h-ui.admin/css/style.css" />
<link rel="stylesheet" href="../lib/zTree/v3/css/zTreeStyle/zTreeStyle.css" type="text/css">
<!--[if IE 6]>
<script type="text/javascript" src="http://lib.h-ui.net/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>生产报表</title>
</head>
<body class="pos-r">
<div style="margin-left:5px;">
	<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 生产报表 <span class="c-gray en">&gt;</span> 母猪生产成绩表 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
	<div class="page-container">
		<div class="text-c"> 
			<input type="text" name="" id="earnum" placeholder=" 耳号" style="width:250px" class="input-text">
			<input type="text" name="" id="gname" placeholder=" 猪舍" style="width:250px" class="input-text">
			<button name="" id="" class="btn btn-success" type="submit" onclick="getSowInfos()"><i class="Hui-iconfont">&#xe665;</i> 查询</button>
				<button name="" id="" class="btn btn-success" onClick ="tableExport('table')"><i class="Hui-iconfont">&#xe644;</i> 导出</button> 
			<button name="" id="print" class="btn btn-success" onClick="print()"><i class="Hui-iconfont">&#xe652;</i> 打印</button>
		</div>
		<div class="mt-20">
			<table id="table" class="table table-border table-bordered table-bg table-hover ">
				<!--  <thead>
					<tr class="text-c">
						<th width="40">耳号</th>
						<th width="40">舍号</th>
						<th width="40">栏位</th>
						<th width="40">配种次数</th>
						<th width="40">受胎次数</th>
						<th width="40">受胎率</th>
						<th width="40">产仔总数</th>
						<th width="40">总重量</th>
						<th width="40">成活率</th>
					</tr>
				</thead>
				<tbody>
					<tr class="text-c va-m">
						<td>y004</td>
						<td>后备舍</td>
						<td>001</td>
						<td>0</td>
						<td>0</td>
						<td>100</td>
						<td>0</td>
						<td>0.00</td>
						<td>100</td>
					</tr>
				</tbody> -->
				
			</table>
			<div class="foot">
				 <a href="javascript:void(0)" id="before" class="pages" >上一页</a> 
				 <a id="recordall" class="word">0 条记录</a> <a id="pagecount" class="word"> 0/0页</a>
				 <a href="javascript:void(0)" id="after" class="pages" >下一页</a>&nbsp; &nbsp;
				</div>
			</div>
		</div>
	</div>
</div>
<script type="text/javascript" src="../lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="../lib/layer/2.1/layer.js"></script>
<script type="text/javascript" src="../lib/My97DatePicker/WdatePicker.js"></script> 
<script type="text/javascript" src="../lib/datatables/1.10.0/jquery.dataTables.min.js"></script> 
<script type="text/javascript" src="../lib/zTree/v3/js/jquery.ztree.all-3.5.min.js"></script> 
<script type="text/javascript" src="../static/h-ui/js/H-ui.js"></script> 
<script type="text/javascript" src="../static/h-ui.admin/js/H-ui.admin.js"></script>
 <script type="text/javascript" src="../js/jQuery.print.js"></script> 
<script type="text/javascript" src="../js/leadout.js"></script>  
<script type="text/javascript">
function print(){
	$.print("#table");
	
	 
}
$(function (){

	 $.post("../sow.do",{"v":"query"},function(data){
		 $("#recordall").html(data.recordall+"条记录");
			$("#pagecount").html(data.page+"/"+data.pageCount+"页");
			$("#before").attr("href", "javascript:pagination("+(data.page-1)+");");
			$("#after").attr("href", "javascript:pagination("+(parseInt(data.page)+1)+");");
	 		var html="<thead><tr class='text-c'>"
			html +="<th width=\"40\">耳号</th>"
			html +="<th width=\"40\">舍号</th>"
			html +="<th width=\"40\">栏位</th>"
			html +="<th width=\"40\">配种次数</th>"
			html +="<th width=\"40\">受胎次数</th>"
			html +="<th width=\"40\">受胎率</th>"
			html +="<th width=\"40\">产仔总数</th>"
			html +="<th width=\"40\">存活率</th></th>"
			html +="</tr></thead>";
	 $.each(data.list,function(i,v) {  
		  html +='<tbody><tr class="text-c va-m"><td>'+v.pig_ear_num+'</td>';
		  html +='<td>'+v.gra_name+'</td>';
		  html +='<td>'+v.cla_name+'</td>';
		  html +='<td>'+v.btime+'</td>';
		  html +='<td>'+v.ptime+'</td>';
		  html +='<td>'+v.crate+'</td>';
		  html +='<td>'+v.scount+'</td>';
		  html +='<td>'+v.lrate +'</td></tr></tbody>';
   });  
	 $("#table").html(html)
	
},"json");
})

//查询
function getSowInfos(){
	var earnum = $("#earnum").val();
	var gname = $("#gname").val()
		$(".foot").hide();
		 $.post("../sow.do",{"v":"getSowInfos","earnum":earnum,"gname":gname},function(data){
			 if(data==null||data==""){
					alert("输入有误，请重新输入！")
					$("#earnum").val("").focus();
					$("#gname").val("");
				}else{
			 var html="<thead><tr class='text-c'>"
					html +="<th width=\"40\">耳号</th>"
						html +="<th width=\"40\">舍号</th>"
						html +="<th width=\"40\">栏位</th>"
						html +="<th width=\"40\">配种次数</th>"
						html +="<th width=\"40\">受胎次数</th>"
						html +="<th width=\"40\">受胎率</th>"
						html +="<th width=\"40\">产仔总数</th>"
						html +="<th width=\"40\">存活率</th>"
					html +="</tr></thead>";
	 				$(data).each(function(i,v){
	 					html +='<tbody><tr class="text-c va-m"><td>'+v.pig_ear_num+'</td>';
	 					  html +='<td>'+v.gra_name+'</td>';
	 					  html +='<td>'+v.cla_name+'</td>';
	 					  html +='<td>'+v.btime+'</td>';
	 					  html +='<td>'+v.ptime+'</td>';
	 					  html +='<td>'+v.crate+'</td>';
	 					  html +='<td>'+v.scount+'</td>';
	 					  html +='<td>'+v.lrate +'</td></tr></tbody>';
	 		 
	 				});
				  
		 		$("#table").html(html)	
				}
		},"json");
	}
	

//分页
function  pagination(obj){
	 $.post("../sow.do",{"v":"query","page":obj},function(data){
		 	$("#recordall").html(data.recordall+"条记录");
			$("#pagecount").html(data.page+"/"+data.pageCount+"页");
			$("#before").attr("href", "javascript:pagination("+(data.page-1)+");");
			$("#after").attr("href", "javascript:pagination("+(parseInt(data.page)+1)+");");
			var html="<thead><tr class='text-c'>"
				html +="<th width=\"40\">耳号</th>"
				html +="<th width=\"40\">舍号</th>"
				html +="<th width=\"40\">栏位</th>"
				html +="<th width=\"40\">配种次数</th>"
				html +="<th width=\"40\">受胎次数</th>"
				html +="<th width=\"40\">受胎率</th>"
				html +="<th width=\"40\">产仔总数</th>"
				html +="<th width=\"40\">存活率</th>"
				html +="</tr></thead>";
		 $.each(data.list,function(i,v) { 
			  html +='<tbody><tr class="text-c va-m"><td>'+v.pig_ear_num+'</td>';
			  html +='<td>'+v.gra_name+'</td>';
			  html +='<td>'+v.cla_name+'</td>';
			  html +='<td>'+v.btime+'</td>';
			  html +='<td>'+v.ptime+'</td>';
			  html +='<td>'+v.crate+'</td>';
			  html +='<td>'+v.scount+'</td>';
			  html +='<td>'+v.lrate +'</td></tr></tbody>';
         });  
	 $("#table").html(html)
	
	},"json");
}

</script>
</body>
</html>